package com.example.provider.service.Impl;

import java.util.List;

import com.example.common.model.SquareArticleComments;
import com.example.common.model.condition.SquareArticleCommentsCondition;
import com.example.provider.mapper.SquareArticleCommentsMapper;
import com.example.provider.service.SquareArticleCommentsService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;


/**
 * 广场文章用户评论表Service接口实现
 *
 * @author 510
 * @version 1.0.0 2021-04-23
 */
@Service
@Transactional(readOnly = true)
public class SquareArticleCommentsServiceImpl extends ServiceImpl<SquareArticleCommentsMapper, SquareArticleComments> implements SquareArticleCommentsService {
    private static final Logger logger = LoggerFactory.getLogger(SquareArticleCommentsService.class);

    @Override
    public IPage<SquareArticleComments> findSquareArticleCommentsByCondition(SquareArticleCommentsCondition condition) {
        IPage<SquareArticleComments> page = condition.buildPage();
        QueryWrapper<SquareArticleComments> queryWrapper = condition.buildQueryWrapper(SquareArticleComments.class);
        return this.page(page, queryWrapper);
    }

    @Override
    public SquareArticleComments getSquareArticleCommentsById(Integer id) {
        return this.getById(id);
    }

    @Transactional
    @Override
    public boolean addSquareArticleComments(SquareArticleComments squareArticleComments) {
        return this.save(squareArticleComments);
    }

    @Transactional
    @Override
    public boolean updateSquareArticleComments(SquareArticleComments squareArticleComments) {
        return this.updateById(squareArticleComments);
    }

    @Transactional
    @Override
    public boolean deleteSquareArticleCommentsById(Integer id) {
        return this.removeById(id);
    }

    @Transactional
    @Override
    public boolean deleteSquareArticleCommentsByIds(List<Integer> idList) {
        return this.removeByIds(idList);
    }
}